home *** CD-ROM | disk | FTP | other *** search
/ The Best of Down Under Games / The Best of Down Under Games.iso / 3dfx Screen Savers / VoodooLights / Sources / defines.h < prev    next >
C/C++ Source or Header  |  1997-07-14  |  1KB  |  66 lines

  1. #ifndef _DEFINES_H_
  2. #define _DEFINES_H_
  3. #include <stdlib.h>
  4. #include <string.h>
  5. /*
  6.    * pseudo-tipos:
  7. */
  8.  
  9. #define Byte    unsigned char
  10. #define Word    unsigned short int 
  11. #define Long    unsigned int 
  12. #define    Bool    int    
  13. #define Float   float
  14.  
  15. /*
  16.    * pseudo-constantes:
  17. */
  18.  
  19. #define True         1
  20. #define False        0
  21. #define EPSILON      1e-8 
  22. #define ZERO           EPSILON 
  23. #define M_1_MAXINT     4.65661287524579692410E-10 /*1/(2^31-1) 1/meu maxint 32bits*/
  24. #define M_1_255        (1.0 / 255.0) 
  25. #define M_1_65535   (1.0 / 65535.0) 
  26. #define M_1_65500   (1.0 / 65500.0) 
  27.  
  28. #define SNAP_BIAS    (Float)(1<<19)
  29.  
  30. #define PI 3.14159265358979323846
  31.  
  32. #ifndef NULL
  33. #define NULL     0
  34. #endif
  35.  
  36. #define sqr( X )  ( (X) * (X) )                       /* quadrado de X */
  37. #define RAD(X)    (3.14159265358979323846*(X)/180.0) /* graus -> radianos */
  38. #define rnd()        ((Float)rand()*(1.0f /(Float)RAND_MAX))
  39.  
  40. #undef fabs
  41. #define fabs(a)     ( (a) > 0 ? (a) : -(a) )
  42.  
  43. #define sgn(a)      ((a)<0?-1:((a)?1:0))
  44.  
  45.  
  46. #define Swap( TYPE, a, b )    { TYPE tmp ; tmp = a ; a = b ; b = tmp ; } 
  47.  
  48. #define New( TYPE, N )          ( TYPE *)malloc( (N) * sizeof( TYPE ) )
  49. #define Delete( N )        free( (char *)N )
  50.  
  51. #define random    rand
  52.  
  53.  
  54. #ifndef max
  55. #define max( a, b )   ((a) > (b) ? (a) : (b))
  56. #endif
  57.  
  58. #ifndef min
  59. #define min( a, b )   ((a) < (b) ? (a) : (b))
  60. #endif
  61.  
  62. #ifndef bcopy
  63. #define bcopy(src, dst, n )    memcpy( dst, src, n ) 
  64. #endif 
  65. #endif /* _DEFINES_H_ */
  66.